<?php 
require_once 'Admin.service.class.php';
//接受用户数据
$id=$_POST['id'];
$password=$_POST['password'];
$savecookie=$_POST['savecookie'];
$adminservice=new AdminService();

if($name=$adminservice->checkAdmin($id, $password)){
    //echo $savecookie;
    if($savecookie=="on"){
        setcookie("userid",$id,time()+300);
    }
    session_start();
    $_SESSION['name']=$id;
    header("Location:emsManager.php?name=$name");
    exit();
}

    header("Location:login.php?errorno=1");
    exit();

/* if($id=="vdm" && $password=="123"){
    
    header("Location:emsManager.php");
    //如果要使用header跳转,最好带上exit();
    exit();
}else{
    header("Location:login.php?errorno=1");
    exit();
} */
?>